package me.wangxuan.pat;
import javax.swing.*;
import java.awt.*;
public class IconButtonExample extends JFrame {
    public IconButtonExample() {
        setTitle("Icon Button Example");
        setSize(400, 300);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null); // Center the window

        // 创建一个面板
        JPanel panel = new JPanel();
        panel.setLayout(new FlowLayout());

        String[] icons = new String[] 
        		{"FileView.floppyDriveIcon",
        				"Tree.expandedIcon",
//        				"InternalFrame.iconifyIcon",
//        				"CheckBox.icon",
        				"Tree.closedIcon",
//        				"Menu.arrowIcon",
        				"OptionPane.questionIcon",
        				"FileView.computerIcon",
        				"Slider.horizontalThumbIcon",
        				"html.pendingImage",
        				"html.missingImage",
        				"Slider.verticalThumbIcon",
        				"FileChooser.homeFolderIcon",
        				"OptionPane.warningIcon",
        				"FileView.hardDriveIcon",
        				"FileChooser.listViewIcon",
//        				"InternalFrame.closeIcon",
        				"FileView.directoryIcon",
//        				"CheckBoxMenuItem.checkIcon",
        				"FileChooser.detailsViewIcon",
//        				"InternalFrame.maximizeIcon",
        				"Table.ascendingSortIcon",
//        				"RadioButtonMenuItem.checkIcon",
//        				"RadioButtonMenuItem.arrowIcon",
//        				"InternalFrame.paletteCloseIcon",
        				"OptionPane.informationIcon",
        				"FileView.fileIcon",
        				"OptionPane.errorIcon",
//        				"MenuItem.arrowIcon",
        				"Tree.openIcon",
//        				"RadioButton.icon",
        				"Tree.leafIcon",
        				"Tree.collapsedIcon",
//        				"CheckBoxMenuItem.arrowIcon",
        				"Table.descendingSortIcon",
//        				"InternalFrame.icon",
        				"FileChooser.newFolderIcon",
//        				"InternalFrame.minimizeIcon",
        				"FileChooser.upFolderIcon"
        				};
        
        for(int i=0;i< icons.length;i++) {
        	String key = icons[i];
        	Icon icon = UIManager.getIcon(key);
        	System.out.println(key);
        	System.out.println(icon);
        	JLabel label = new JLabel(i+"", icon, SwingConstants.LEFT);
        	panel.add(label);
        }
       
        // 添加面板到 JFrame
        Container contentPane = getContentPane();
        contentPane.add(panel);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            IconButtonExample example = new IconButtonExample();
            example.setVisible(true);
        });
    }
}
